Hi list,
I'm not only a novice to pgsql but also to sql in general (as well as new in this list)...
Here's my question: Why doesn't the following function work?
create function getoid(name) returns integer as '
declare
ret integer;
tablename alias for $1;
begin
select into ret oid from tablename;
return ret;
end;'
language 'plpgsql';
The idea is to get the oid (or whatever) from a table given by its name as a parameter to the function. It seems that the 'from' clause can't get the right table when passing a variable with the table name. I've tried everything to get this to work (castings, subqueries, etc, etc,...)
Thanx in advance! :-)
Cheers,
Nick